//
//  IntelligentGarageViewController.m
//  PeopleStreet
//
//  Created by 辰领科技 on 16/7/7.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "IntelligentGarageViewController.h"


@interface IntelligentGarageViewController ()
@property (weak, nonatomic) IBOutlet UIScrollView *scroView;
@property (strong, nonatomic) IBOutlet UIView *viewOne;
@property (strong, nonatomic) IBOutlet UIView *viewTwo;
@property (strong, nonatomic) IBOutlet UIView *viewThree;
@property (strong, nonatomic) IBOutlet UIView *ViewFour;
@property (strong, nonatomic) IBOutlet UIView *viewFive;
@property (strong, nonatomic) IBOutlet UIView *viewSix;

@property (strong, nonatomic) IBOutlet UIButton *headerButton;//头像
@property (strong, nonatomic) IBOutlet UILabel *nameLabel;//名字
@property (strong, nonatomic) IBOutlet UILabel *identityLabel;//业主
@property (strong, nonatomic) IBOutlet UILabel *moneyLabel;//停车余额
@property (strong, nonatomic) IBOutlet UILabel *ParkingSpaceLabel;//剩余车位
@property (strong, nonatomic) IBOutlet UILabel *ParkingInformationLabel;//车位总数 && 预约车位数
@property (strong, nonatomic) IBOutlet UILabel *parkingMoneyLabel;//停车费
@property (strong, nonatomic) IBOutlet UIButton *topupButton;//充值


@end

@implementation IntelligentGarageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initViewLayout];
}

- (void)initViewLayout{
    
    [self adaptiveViewLayout:self.view];
    [self adaptiveViewLayout:self.scroView];
    [self adaptiveViewLayout:self.viewOne];
    [self adaptiveViewLayout:self.viewTwo];
    [self adaptiveViewLayout:self.viewThree];
    [self adaptiveViewLayout:self.ViewFour];
    [self adaptiveViewLayout:self.viewFive];
    [self adaptiveViewLayout:self.viewSix];
    
    _scroView.contentSize = flexibleSize(CGSizeMake(0, 569), NO);
    
    self.topupButton.layer.cornerRadius = 12*VerticalRatio();
    self.topupButton.layer.borderColor = [UIColor colorWithRed:1.000 green:0.918 blue:0.000 alpha:1.000].CGColor;
    self.topupButton.layer.borderWidth = 1;
    
    self.identityLabel.layer.cornerRadius = 5*VerticalRatio();
}

#pragma mark - 获取账户余额
-(void)TheAccountBalance{
    
    NSMutableDictionary  *dic=[NSMutableDictionary dictionary];
    [dic setObject:@"queryMallADDData" forKey:@"method"];
    [dic setObject:@"1" forKey:@"position"];
    [dic  setObject:[NSNumber numberWithInteger:PageSize]       forKey:@"pageSize"];
    self.shareApi.delegate=self;
    [self.shareApi  requestOperationWithDic:dic withPath:SX_ADBanner withHttpType:@"POST" withTag:SX_kADBannerTag];
}

#pragma mark - 充值
- (IBAction)topup:(id)sender {
    NSMutableDictionary  *dic=[NSMutableDictionary dictionary];
    [dic setObject:@"queryMallADDData" forKey:@"method"];
    [dic setObject:@"1" forKey:@"position"];
    [dic  setObject:[NSNumber numberWithInteger:PageSize]       forKey:@"pageSize"];
    self.shareApi.delegate=self;
    [self.shareApi  requestOperationWithDic:dic withPath:SX_ADBanner withHttpType:@"POST" withTag:SX_kADBannerTag];
}

#pragma mark - 预约停车
- (IBAction)one:(id)sender {
    UIStoryboard *secondStroyBoard=[UIStoryboard storyboardWithName:@"HomeStoryboard" bundle:nil];
    UIViewController *page = [secondStroyBoard instantiateViewControllerWithIdentifier:@"MakeAnAppointmentToStop"];
    [self.navigationController   pushViewController:page animated:YES];
}

#pragma mark - 场内找车
- (IBAction)two:(id)sender {
    UIStoryboard *secondStroyBoard=[UIStoryboard storyboardWithName:@"HomeStoryboard" bundle:nil];
    UIViewController *page = [secondStroyBoard instantiateViewControllerWithIdentifier:@"LookingForCar"];
    [self.navigationController   pushViewController:page animated:YES];
}

#pragma mark - 缴费停车
- (IBAction)Three:(id)sender {
    UIStoryboard *secondStroyBoard=[UIStoryboard storyboardWithName:@"HomeStoryboard" bundle:nil];
    UIViewController *page = [secondStroyBoard instantiateViewControllerWithIdentifier:@"Query"];
    [self.navigationController   pushViewController:page animated:YES];

}

#pragma mark - 升降取车
- (IBAction)four:(id)sender {
}

#pragma mark - 车辆充电
- (IBAction)five:(id)sender {
}

#pragma mark - 我的停车
- (IBAction)six:(id)sender {
    UIStoryboard *secondStroyBoard=[UIStoryboard storyboardWithName:@"HomeStoryboard" bundle:nil];
    UIViewController *page = [secondStroyBoard instantiateViewControllerWithIdentifier:@"MyParkCars"];
    [self.navigationController   pushViewController:page animated:YES];

}

#pragma mark - 返回
- (IBAction)back:(id)sender {
    [self.navigationController  popViewControllerAnimated:YES];
}




#pragma   mark---- GetADBanner Request Delegate

-(void)fetchDatabaseFinished:(NSMutableDictionary *)database withTag:(NSInteger)tag{
    
    if (tag==SX_kADBannerTag) {
        
        if (  [[database valueForKey:@"type"] integerValue]!=1 ) {
            
            [[CWHUDTips sharedInstance]  showTips:[database valueForKey:@"msg"]  withStatus:1 dismissAfter:1.5];
            
        }else  {
        
            
            
        }
    } else if (tag==SX_kADBannerTag) {
        
        if (  [[database valueForKey:@"type"] integerValue]!=1 ) {
            
            [[CWHUDTips sharedInstance]  showTips:[database valueForKey:@"msg"]  withStatus:1 dismissAfter:1.5];
            
        }else  {
            
            
            
        }
    }
    
}

-(void)fetchDatabaseFailed:(NSError *)error message:(NSString *)message{
    
    //
    [self dismissWaitDialog];
    
    
}




@end
